package com.hhh.Service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hhh.Mapper.OrderDetailMapper;
import com.hhh.Pojo.OrderDetail;
import com.hhh.Service.OrderDetailSeivce;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderDetailSerivce implements OrderDetailSeivce {
    @Autowired
    OrderDetailMapper orderDetailMapper;

    //    添加详细订单信息
    @Override
    public Integer Insert(List<OrderDetail> orderDetailList) {
        int num = 0;
        for (OrderDetail detail : orderDetailList)
            num += orderDetailMapper.insert(detail);
        return num;
    }

    //    查询详细订单信息
    @Override
    public List<OrderDetail> SelectList(long OrderId) {
        QueryWrapper<OrderDetail> wrapper = new QueryWrapper<>();
        wrapper.eq("order_id", OrderId);
        return orderDetailMapper.selectList(wrapper);
    }
}
